﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Motorway_Simulator
{
    public partial class MotorwaySimulator : Form
    {
        private SimulationController control;

        public MotorwaySimulator()
        {
            InitializeComponent();
            control = new SimulationController();
            //carUserControl1.Visible = false;
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
            openFile.ShowDialog();
        }

        private void openFile_FileOk(object sender, CancelEventArgs e)
        {
            
            openFile.ShowDialog();
        }

        
        private void designViewToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            this.Text = "Motorway Simulator - Design Mode";
            //listBox1.Visible = false;
            DesignToolBox.Visible = true;
            simulationViewToolStripMenuItem.Checked = false;
            designViewToolStripMenuItem1.Checked = true;
        }

        private void simulationViewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Text = "Motorway Simulator - Simulation Mode";
            playToolStripMenuItem.Enabled = true;
            DesignToolBox.Visible = false;
            
            //listBox1.Visible = true;
            
            designViewToolStripMenuItem1.Checked = false;
            simulationViewToolStripMenuItem.Checked = true;
            
        }


        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            saveFile.ShowDialog();

        }

        private void playToolStripMenuItem_Click(object sender, EventArgs e)
        {
            playToolStripMenuItem.Enabled = false;
            pauseToolStripMenuItem.Enabled = true;
            stopToolStripMenuItem.Enabled = true;
            
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void playToolStripButton_Click(object sender, EventArgs e)
        {
            control.Start();
        }

        private void pauseToolStripButton_Click(object sender, EventArgs e)
        {
            control.Pause();
        }

        private void stopToolStripButton_Click(object sender, EventArgs e)
        {
            control.Stop();
        }

        private void restartToolStripButton_Click(object sender, EventArgs e)
        {
            control.Restart();
        }

        

    }
}
